from django.db import models


class PayMain(models.Model):
    Pid = models.AutoField(primary_key=True)
    Eid = models.CharField(max_length=10)
    Pcount = models.IntegerField()
    Ptotal = models.FloatField()
    Pdate = models.CharField(max_length=8)
    other = models.CharField(max_length=20, blank=True, null=True)

    class Meta:
        db_table = 'tb_pay_main'

    def __str__(self):
        return f'Pid: {self.Pid}, Eid: {self.Eid}, Pdate: {self.Pdate}'


class PayDetail(models.Model):
    PDid = models.AutoField(primary_key=True)
    Pid = models.IntegerField()
    Gid = models.CharField(max_length=20, blank=True, null=True)
    Pcount = models.IntegerField()
    GPay = models.FloatField()
    total = models.FloatField()
    other = models.CharField(max_length=20, blank=True, null=True)

    class Meta:
        db_table = 'tb_pay_detail'

    def __str__(self):
        return f'PDid: {self.PDid}, Pid: {self.Pid}, Gid: {self.Gid}, Pcount: {self.Pcount}'
